package com.th.common.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.stream.Stream;

@Getter
@AllArgsConstructor
public enum BankType {

    CCB(0,"建设银行"),
    ABC(1,"农业银行"),
    ICBC(2,"工商银行"),
    PSBC(3,"邮政银行"),
    BOC(4,"中国银行"),
    CMB(5,"招商银行");

    private Integer code;
    private String name;

    public static BankType of(Integer code){
        return Stream.of(values()).
                filter(bean -> bean.code.equals(code))
                .findAny()
                .orElse(null);
    }
}
